<script type="text/javascript">
    var THEME = '<?=THEME?>';
    var TEMPLATE = '<?=TEMPLATE?>';
    var url = '/json/<?=TEMPLATE?>/<?=$params[0]?>,<?=$params[1]?>';
    var lang = ({
            'file_selected':'<?=uygulama::translate("file/files selected.")?>',
            'start_upload':'<?=sprintf(uygulama::translate("%s click here %s to start upload."),"<u>","</u>")?>',
            'thumbnail':'<?=uygulama::translate("Thumbnail")?>',
            'original_size':'<?=uygulama::translate("Orginal size")?>',
            'left':'<?=uygulama::translate("Left")?>',
            'right':'<?=uygulama::translate("Right")?>',
            'none':'<?=uygulama::translate("None")?>',
            'add':'<?=uygulama::translate("ADD")?>',
            'delete_image':'<?=uygulama::translate("Delete Image")?>',
            'are_you_sure':'<?=uygulama::translate("Are you sure delete the imege?")?>'
        });
</script>
<form id="form" method="POST" action="/json/<?=TEMPLATE.'/'.$params[0].','.$params[1]?>">
<div class="formItem">
<label><?=uygulama::translate('Title')?>:</label>
<input id="title" name="title" class="wide" type="text" value="<?=$page->page->$lang->title?>" />
<span class="clear"></span>
</div>
<div class="formItem">
<label><?=uygulama::translate('Description')?>:</label>
<input id="description" name="description" class="wide" type="text" value="<?=$page->page->$lang->description?>" />
<span class="clear"></span>
</div>
<div class="formItem">
<label><?=uygulama::translate('Keywords')?>:</label>
<input id="keywords" name="keywords" class="wide" type="text" value="<?=$page->page->$lang->keywords?>" />
<span class="clear"></span>
</div>
<!-- MEDIA -->
<div class="formItem">
    <label class="formLabel"><?=uygulama::translate('Photos')?>:</label>
    <div class="uploader">
        <object id="mediaUploader" type="application/x-shockwave-flash" data="/lib/f4/uploader.swf" width="80" height="26">
            <param name="movie" value="/lib/f4/uploader.swf" />
            <param name="quality" value="high" />
            <param name="wmode" value="window" />
            <param name="allowScriptAccess" value="sameDomain" />
            <param name="flashVars" value="callback=mediaUploader
                    &uploadurl=/upload/<?=TOKEN?>/<?=$params[0]?>,<?=$params[1]?>
                    &filetypes=*.jpeg;*.jpg;*.gif;*.png;
                    &typetext=Media (.jpeg;.jpg;.gif;.png;)
                    &labeltext=<?=uygulama::translate('Browse')?>
                    &fontcolor=#ffffff
                    &bgcolor=0x111111
                	&autoupload=1"/>
        </object>
        <span id="uploaderdesc" class="uploaderLabel"><?=uygulama::translate('Select photos')?></span>
    </div>
    <div class="clear"></div>
</div>
<div id="mediaContainer">
    <?if($page->page->media) foreach($page->page->media as $k=>$i):?>
    <div id="<?=$k?>" class="media">
        <div class="thumb">
            <img src="/<?=$i->thumb?>" alt="<?=$i->alt?>" />
        </div>
        <div class="name inlineedit" data-id="<?=$k?>" data-url="/json/<?=TEMPLATE?>/<?=$params[0]?>,<?=$params[1]?>,alt"><?=$i->alt?></div>
        <a class="button remove" onclick="mediaRemove('<?=$k?>');">x</a>
    </div>
    <?endforeach;?>
</div>
<div class="clear"></div>
<!-- SUBMIT -->
<div class="formSubmit">
<span id="loader" class="loader"><img src="/themes/<?=THEME?>/images/loader.gif" alt="loader" /></span>
<input type="submit" value="<?=uygulama::translate('Save')?>" />
</div>
</form>
<script type="text/javascript">
tool.sortable('mediaContainer','img',{'url':'/json/<?=TEMPLATE?>/<?=$params[0].','.$params[1].',sort'?>'});
tool.inlineedits();
tool.form();
var projecttitle = ('<?=TITLE?>'.length+3);
$('#title').keyup(function(){
    tool.lengthcheck('title',5,70-projecttitle);
});
tool.lengthcheck('title',5,70-projecttitle);
$('#description').keyup(function(){
    tool.lengthcheck('description',70,120);
});
tool.lengthcheck('description',70,120);
</script>